// 访问静态资源
let http = require('http')
let fs = require('fs')

let server = http.createServer(function (req,res) { 
  let url = req.url
  fs.readFile('.'+ url, function (err, data) { 
    if(err){
      res.writeHead(404, {
        'Content-type': 'text/html'
      })
    }
      res.writeHead(200, {
        'Content-type' : 'text/html'
      })
      res.end(data)
  })
})
server.listen(3000,function () {  
  console.log('runing')
})